//
//  CountyDataModel.m
//  AroundTheWorld
//
//  Created by dllo on 16/5/19.
//  Copyright © 2016年 IfelseGo an. All rights reserved.
//

#import "CountyDataModel.h"
#import "Hot_cityModel.h"
#import "Hot_mguideModel.h"
#import "New_discountModel.h"

@implementation CountyDataModel
//容错方法
- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"id"]) {
        self.countryID = value;
    }
    if ([key isEqualToString:@"new_discount"]) {
        self.countryNew_discount = value;
    }
    if ([key isEqualToString:@"photos"]) {
        for (NSString *photoName in value) {
            [self.photos addObject:photoName];;
        }
    }
}
//重写set方法
- (void)setHot_city:(NSMutableArray *)hot_city
{
    _hot_city = hot_city;
    NSMutableArray *array = [NSMutableArray array];
    for (NSDictionary *dic in _hot_city) {
        Hot_cityModel *model = [[Hot_cityModel alloc] init];
        [model setValuesForKeysWithDictionary:dic];
        [array addObject:model];
    }
    _hot_city = [NSMutableArray arrayWithArray:array];
}

- (void)setHot_mguide:(NSMutableArray *)hot_mguide
{
    _hot_mguide = hot_mguide;
    NSMutableArray *array = [NSMutableArray array];
    for (NSDictionary *dic in _hot_mguide) {
        Hot_mguideModel *model = [[Hot_mguideModel alloc] init];
        [model setValuesForKeysWithDictionary:dic];
        [array addObject:model];
    }
    _hot_mguide = [NSMutableArray arrayWithArray:array];
}

- (void)setCountryNew_discount:(NSMutableArray *)countryNew_discount
{
    _countryNew_discount = countryNew_discount;
    NSMutableArray *array = [NSMutableArray array];
    for (NSDictionary *dic in _countryNew_discount) {
        New_discountModel *model = [[New_discountModel alloc] init];
        [model setValuesForKeysWithDictionary:dic];
        [array addObject:model];
    }
    _countryNew_discount = [NSMutableArray arrayWithArray:array];
}

@end
